/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package cz.cuni.amis.episodic.bayes.utils;

import cz.cuni.amis.episodic.dybanem.ProbabilityUtils;
import lombok.Data;

/**
 *
 * @author ik
 */
@Data
public class NodeSnapshot {
   
    public NodeSnapshot(String name) {
        this.node = name;
    }
    
    /**
     * Entropy of this node's probabilities based on observations known to time
     * t.
     */
    double[] entropy;

    double[][] probability;
    
    
     /**
     * Node's name.
     */
    String node;
   
    /**
     * Computes KL of this distribution to some target "real" distribution.
     * @param real
     * @return 
     */
    public double[] computeKLDivergenceTo(NodeSnapshot real) {
        double[] kl = new double[probability.length];
        for(int i = 0; i < kl.length; i++) {
            kl[i] = ProbabilityUtils.kullbackLiebrerDivergence(probability[i], real.probability[i]);
        }
        return kl;
    }
}
